import React from 'react'

import { Form, Select, Field, } from '@alifd/next';
class Uischema extends React.Component {
  constructor(props) {
    super(props)
    this.form = new Field(this, {
      onChange: (name: string, value: any) => {
        const values: any = this.form.getValues();
        const { onChange } = this.props;
        if (onChange) {
          onChange(values);
        }
      },
    });
  }
  render() {
    const init = this.form.init;
    return (
      <Form field={this.form}>
        <Form.Item
          required={true}
          label="测试"
        >
          <Select
            {...init('test', {
              initValue: '123',
            })}
            dataSource={[
              {
                label: '123',
                value: '123'
              },
              {
                label: '1234',
                value: '1234'
              },
            ]}
          />
        </Form.Item>
      </Form>
    )
  }
}

export default Uischema
